(function() {
  const ua = navigator.userAgent;
  const isIpad = !!ua.match(/(iPad).*OS\s([\d_]+)/),
  isIphone = !!(!isIpad && ua.match(/(iPhone\sOS)\s([\d_]+)/)),
  isAndroid = !!ua.match(/(Android)\s+([\d.]+)/),
  isWechat = ua.toLowerCase().indexOf('micromessenger') > -1;
  window.isMobile = isIphone || isAndroid || isWechat;
})();
